import { PrismaClient } from '@prisma/client';

// Basic types
export type UserRole = 'USER' | 'ADMIN';
export type QuestionType = 'MULTIPLE_CHOICE' | 'TEXT';
export type Difficulty = 'EASY' | 'MEDIUM' | 'HARD';
export type Status = 'PENDING' | 'COMPLETED' | 'FAILED';

// Database models
export interface TestUser {
  id: number;
  email: string;
  name: string;
  role: UserRole;
  createdAt: Date;
  updatedAt: Date;
}

export interface TestQuestion {
  id: number;
  text: string;
  type: QuestionType;
  options: string[];
  correctAnswer?: string | null;
  difficulty: Difficulty;
  createdAt: Date;
  updatedAt: Date;
}

export interface TestEvaluation {
  id: number;
  userId: number;
  questionId: number;
  answer: string;
  score: number;
  feedback?: string;
  status: Status;
  createdAt: Date;
  updatedAt: Date;
}

export interface TestAuditLog {
  id: number;
  userId: number;
  action: string;
  description: string;
  ipAddress: string;
  userAgent: string;
  createdAt: Date;
}

// Input types
export interface TestUserInput {
  email: string;
  password: string;
  name: string;
  role: UserRole;
}

// Prisma SQL helper types
export type SqlTemplate = ReturnType<PrismaClient['$queryRaw']>;
export type SqlExecute = ReturnType<PrismaClient['$executeRaw']>;
